<?php
	header("content-type:text/html;charset=utf-8");
	$serverName="localhost";
	$userName="root";
	$password="root";
	$dbName="yx";
	
	$conn =new mysqli($serverName,$userName,$password,$dbName);
	mysqli_set_charset($conn,'utf8');
	
	echo"<br>";
	if(mysqli_connect_error()){
		die("链接失败：".mysqli_connect_error());
	}else{
		echo "成功";
	}
	echo "<br>";
	
	$sql="select * from yxb";
	$result=mysqli_query($conn,$sql);



	 $yxmc=$_POST['yxm'];
	 $yxjg=$_POST['yxj'];
	 $yxpf=$_POST['pf'];
	 $yxdx=$_POST['yxdx'];
	 $yxpt=$_POST['yxpt'];
	 $yxms=$_POST['ms'];
	 $fxsj=$_POST['sj'];
	$sj=$_POST['lx'];
	$sj=implode(",", $sj);//一个字符串；
	$yy=$_POST['yy'];
	$yy=implode(",", $yy);//一个字符串；
	 $tp=$_FILES["file"]["name"];

	 
	 // if(isset($_POST['lx'])==true){	 		
	 // 		foreach($_POST['lx'] as $lx)
	 // 		echo $lx;
	 			
	 		
	 // }
	 // if(isset($_POST['yy'])==true){
	 // 		foreach($_POST['yy'] as $yy)
	 // 		echo $yy;
	 			
	 		
	 // }
	 

	 
	 
	 
	 
	
	
		$sql="INSERT INTO yxb VALUES ('$yxmc',$yxjg,'$yxpf',$yxdx,'$yxpt','$yxms','$fxsj','$sj','$yy','$tp')";
	
	
	if(mysqli_query($conn,$sql )){
				echo " <body onLoad=\"parent.location='http://localhost'\">";
	   		}else{
	   		 	echo "Error:".$sql."<br>".mysqli_error($conn);
	   		}





?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
</html>